{% extends 'photoapp/base.html' %}

{% block title %}
    编辑相片
{% endblock %}

{% block body %}
    <form action="" method="post" enctype="multipart/form-data">
        {% csrf_token %}
        <input type="hidden" name="photo_id" value="{{ photo.id }}">
        <table>
            <tbody>
                <tr>
                    <td>标题：</td>
                    <td><input type="text" name="title" value="{{ photo.title }}"></td>
                </tr>
                <tr>
                    <td>图片：</td>
                    <td><input type="file" name="file"></td>
                </tr>
                {% if messages %}
                    <tr>
                        <td></td>
                        <td style="color: red;">
                            {% for message in messages %}
                                {{ message }}
                            {% endfor %}
                        </td>
                    </tr>
                {% endif %}
                <tr>
                    <td></td>
                    <td>
                        <input type="submit" value="确定">
                        <input type="reset" value="重置">
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td><img src="/{{ photo.filepath_s }}" alt=""></td>
                </tr>
            </tbody>
        </table>
    </form>
{% endblock %}